<template lang="">
    <div>
         <!-- 面包屑 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片区 -->
    <el-card class="rights_box">
        <div>
            <el-table
                :data="rightsList"
                stripe
                style="width: 100%"
                border>
                <el-table-column
                   type="index"
                    width="50"
                    label="序号"
                    style="text-align:center">
                </el-table-column>
                 <el-table-column
                    prop="authName"
                    label="权限名称"
                    width="width">
                </el-table-column> <el-table-column
                    prop="path"
                    label="路径"
                    width="width">
                </el-table-column>
                 <el-table-column prop="level" label="权限等级" width="width">
                     <template slot-scope="{row}">
                         <el-tag type="success" v-if="row.level=='0'">一级权限</el-tag>
                         <el-tag type="warning" v-else-if="row.level=='1'">二级权限</el-tag>
                         <el-tag v-else>三级权限</el-tag>
                     </template>
                </el-table-column>
            </el-table>
        </div>
    </el-card>
    </div>
    
    
</template>
<script>
export default {
  name: 'Rights',
  data() {
    return {
      rightsList: [],
    }
  },
  created() {
    this.getRightsList()
  },
  methods: {
    //   获取权限列表的数据
    async getRightsList() {
      let { data: res } = await this.$http.get(`rights/list`)
      if (res.meta.status !== 200) {
        return this.$message.error('获取数据失败')
      }
      this.rightsList = res.data
    },
  },
}
</script>
<style lang="less" scoped>
.rights_box {
  margin-top: 20px;
}
</style>